%%
/* -----------------Options and Declarations Section-----------------
*/
%class Lexer
%line
%column
%function nextToken
%type Token
%eofval{
  return new Token(Token.Label.EOF);
%eofval}

%eofclose
%{
  public int no_of_words = 0;
  private Token token(Token.Label type) {
     return new Token(type, yyline, yycolumn);
  }

  private Token token(Token.Label type, Object value) {
     return new Token(type, yyline, yycolumn, value);
  }
%}
Blanco=[\r\n\t\f]
Reservada=("class" |"attribute" |"operation"|"association"|"generalization"|"composition"|"aggregation"|"realization"|"dependency"|"int"|"String")
Simbolos=("(" | ")" | "," |"{" | "}" | ":"| "+"| "-"| "#" | ";")
Identificador=([a-z]|[A-Z])([a-z]|[0-9])*

%%
/* ------------------------Lexical Rules Section---------------------- */
<YYINITIAL> 
{
 " "   { }
 {Blanco} { }
 {Reservada} {no_of_words++; return token(Token.Label.RESERVADA, new String(yytext())); }
 {Simbolos} {no_of_words++; return token(Token.Label.SIMBOLO, new String(yytext())); }
 {Identificador} {no_of_words++; return token(Token.Label.IDENTIFICADOR, new String(yytext())); }
 .		{return token(Token.Label.ERROR, new String("ERROR"));}
}